package service

import (
	"context"
	"server-asset/internal/model/entity"

	"github.com/gogf/gf/v2/frame/g"
)

type sInspection struct{}

func Inspection() *sInspection {
	return &sInspection{}
}

func (s *sInspection) CheckServers(ctx context.Context) (results []map[string]interface{}, err error) {
	var servers []entity.Server
	err = g.Model("server").Scan(&servers)
	if err != nil {
		return nil, err
	}

	// 模拟巡检逻辑
	for _, server := range servers {
		result := make(map[string]interface{})
		result["serverName"] = server.ServerName
		result["status"] = "正常"
		// 添加实际检查逻辑
		results = append(results, result)
	}

	return results, nil
}
